Consolidate redirects for latest plugin and module pages #266
+6
−4,038
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is a follow on to #261 and should be rebased on top of those changes before merge.
Additionally, this PR is in draft state because it is an alternative proposal to adding a Sphinx extension to handle redirects for latest urls in the
ansible/ansible-documentation
repo: ansible/ansible-documentation#2266Overview of the changes
Similarly to the consolidation of the 2.x redirects in PR #261 these changes remove all the individual redirect rules that point pages in the
plugins
andmodules
paths to thedocs.ansible.com/collections.html
page. This consolidation eliminates the maintenance burden of all the rules in theansible/11/.htaccess
configuration.With the changes in this PR, all pages in the
modules
path get redirected tocollections.html
.For pages in the
plugins
path, only pages under a subdirectory get redirected tocollections.html
. For example:plugins/become/doas.html
redirects tocollections.html
because the page is under thebecome
subdirectory.plugins/callback/tree.html
redirects tocollections.html
because the page is under thecallback
subdirectory.plugins/become.html
andplugins/callback.html
do not redirect because those pages exist on latest: https://docs.ansible.com/ansible/latest/plugins/An alternative approach might be to use a negative lookahead rule such as this one:
A rule like this is more explicit about which pages should get redirected but that seems unnecessary.
Alternative to the Sphinx extension
As mentioned above, the changes here offer an alternative to replacing latest redirect rules with a Sphinx extension in the docs repo: ansible/ansible-documentation#2266
The Sphinx extension is capable of generating html pages that redirect the pages under
plugins
andmodules
to the corresponding collection page, which is arguably a better user experience. Likewise using the Sphinx extension as a means to replace the latest redirect rules means that we won't need to create redirects in the Read The Docs project to migrate to that platform. The extension will handle the redirects as part of the doc build instead.